/**
 * Created by pc on 2018/4/27.
 */
//设置Cookie
function addCookie(name,value,expireHours){
    var cookieString=name+"="+encodeURI(value);
    //判断是否设置过期时间
    if(expireHours>0){
        var date=new Date();
        date.setTime(date.getTime+expireHours*3600*1000);
        cookieString=cookieString+"; expire="+date.toGMTString();
    }
    document.cookie=cookieString;
}
//获取Cookie
function getCookie(name){
    var strCookie=document.cookie;
    var arrCookie=strCookie.split(";");
    for(var i=0;i<arrCookie.length;i++){
        var arr=arrCookie[i].split("=");
        if(arr[0]==name)return decodeURI(arr[1]);
    }
    return "";
}